package com.linuxgt.baidu.zhidao;

import net.sf.json.JSONObject;

import java.util.Map;

/**
 * Created by liuteng on 2016/7/25 0025.
 */
public class JsonTest {
    public static void main(String[] args) {
        String s = "{\"array\":[1,2,3],\"boolean\":true,\"null\":null,\"number\":123,\"object\":{\"a\":\"b\",\"c\":\"d\",\"e\":\"f\"},\"string\":\"Hello World\"}";
        JSONObject jsonObject = JSONObject.fromObject(s);
        boolean b = jsonObject.getBoolean("boolean");
        String s1 = jsonObject.getString("array");
        Map map = (Map) jsonObject.get("object");
        System.out.println(b);
        System.out.println(s1);
        System.out.println(map);
        System.out.println(map.get("a"));
    }
}
